package model;

import java.awt.Graphics;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;


public class Puck extends GameObject
{
        private double radius;
        
        public Puck()
        {
                super();
                movable = true;
                radius = xDim/2;
                
                try{
                        image = ImageIO.read(new File("PuckDefault.png"));
                } catch(IOException e){ 
                }
        }
        
        public Puck(String filename)
        {
                super();
                movable = true;
                radius = xDim/2;
                
                try{
                        image = ImageIO.read(new File(filename));
                } catch(IOException e){ 
                }
        }
        
        public Puck(Puck puck)
        {
                super();
                movable = true;
                this.radius = puck.getRadius();
                this.filename = puck.getFilename();
                
                try{
                        image = ImageIO.read(new File(this.filename));
                } catch(IOException e){ 
                }
                
        }
        
        //@override
        public void setDimX(int x)
        {
                xDim = x;
                yDim = x;
                radius = x/2;
        }
        
        //@override
        public void setDimY(int y)
        {
                yDim = y;
                xDim = y;
                radius = y/2;
        }
        
        public double getRadius()
        {
                return radius;
        }
        
        public void draw(Graphics page)
        {
                page.drawImage(image, (int)getX(), (int)getY(), null);
        }
        
        public void update()
        {
                setX(getX() + getComponentX() * 0.005);
                setY(getY() + getComponentY() * 0.005);
        }

}